package com.tjsinfo.tjsoa.addresslist.action;

import java.util.List;

import javax.jcr.Session;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.addresslist.bo.IAddresslistSendBo;
import com.tjsinfo.tjsoa.common.DESPlus;
import com.tjsinfo.tjsoa.system.vo.User;

public class toReturnSendAddressListUserAction extends Action{
	private IAddresslistSendBo sendBo;

	public void setSendBo(IAddresslistSendBo sendBo) {
		this.sendBo = sendBo;
	}
	
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		String str2 = request.getParameter("str");
		String messageid = request.getParameter("messageid");
		try {
			DESPlus plus = new DESPlus();
			str2 = plus.decrypt(str2);
		} catch (Exception e) {
		}
		String[] s = str2.split("#");
		
		String str = s[0];
		String copyids = s[1];
		String jieshouid = s[2];
		String str1 = str.replace(",", "','");
		str1 = "'"+str1+"'";
		
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("user");
		List list = sendBo.getSendUsersByIds(str1,user.getUser_id());
		request.setAttribute("list", list);
		request.setAttribute("sendUsersId", str1);
		request.setAttribute("messageid", messageid);
		request.setAttribute("copyids", copyids);
		request.setAttribute("userid", Integer.valueOf(jieshouid));
		return mapping.findForward("ok");
	}
}
